<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var minSteps = function (s, t) {
      let res = {};
      for (let ss of s) {
        if (!res[ss]) {
          res[ss] = 1;
        } else {
          res[ss]++;
        }
      }
      // console.log(res);
      for (let tt of t) {
        if (!res[tt]) {
          res[tt] = -1;
        } else {
          res[tt]--;
        }
      }
      let sum = 0;
      Object.values(res).forEach(e => {
        sum += Math.abs(e);
      })
      return sum / 2;

    };
    console.log(minSteps("bab", "aba"));
  </script>
</body>

</html>